package com.ftg.learn.loadbalance;

/**
 * @author 布衣
 */
public class RedisInstance {

    private String host;

    private Integer port;

    //最小连接
    private Integer minConnections;

    //活跃数
    private Integer activeConnections;


    public RedisInstance(String host, Integer port, Integer minConnections) {
        this.host = host;
        this.port = port;
        this.minConnections = minConnections;
    }

    public RedisInstance(String host, Integer port) {
        this.host = host;
        this.port = port;
    }

    @Override
    public String toString() {
        return "RedisInstance{" +
                "host='" + host + '\'' +
                ", port=" + port +
                '}';
    }

    public Integer getMinConnections() {
        return minConnections;
    }

    public void setMinConnections(Integer minConnections) {
        this.minConnections = minConnections;
    }

    public Integer getActiveConnections() {
        return activeConnections == null ? 0 : activeConnections;
    }

    public void setActiveConnections(Integer activeConnections) {
        this.activeConnections = activeConnections;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }
}
